<template>
  <j-modal
    :title="$t('更多信息')"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel">
    <!-- <bis-liability-user-info-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/> -->
    <template slot="footer">
      <a-button @click="handleCancel">{{ $t('关闭') }}</a-button>
    </template>
    <div>
      <a-row :gutter="[0, 30]">
        <a-col>
          <ul>
            <li style="font-weight: bold">{{ $t('孩子信息') }}</li>
          </ul>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="22" :offset="1">
          <a-table :columns="columns" :dataSource="dataSource" :pagination="false" bordered>
          </a-table>
        </a-col>
      </a-row>
      <a-row :gutter="[0, 30]">
        <a-col>
          <ul>
            <li style="font-weight: bold">{{$t('签署免责协议')}}</li>
          </ul>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="22" :offset="1">
          <j-editor v-model="liability" :disabled="true" />
        </a-col>
      </a-row>
    </div>
  </j-modal>
</template>

<script>

import { getAction } from '@/api/manage';
import JEditor from '@/components/jeecg/JEditor'

export default {
  name: 'BisLiabilityUserInfoModal',
  components: {
    JEditor
  },
  data() {
    return {
      title: '',
      width: 800,
      visible: false,
      disableSubmit: false,
      columns: [
        {
          title: this.$t('姓名'),
          align: 'center',
          dataIndex: 'name',
        },
        {
          title: this.$t('性别'),
          align: 'center',
          dataIndex: 'gender_dictText',
        },
        {
          title: this.$t('生日'),
          align: 'center',
          dataIndex: 'birthday',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: this.$t('关系'),
          align: 'center',
          dataIndex: 'relationship_dictText',
        },
      ],
      dataSource: [],
      liability: '',
    }
  },
  methods: {
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleOk() {
      this.$refs.realForm.handleOk();
    },
    submitCallback() {
      this.$emit('ok');
      this.visible = false;
    },
    handleCancel() {
      this.close()
    },
    handleDetail(record) {
      this.visible = true
      getAction('/game/bisLiabilityUserInfo/getChildInfo', {
        id: record.id,
      }).then((res) => {
        if (res.success) {
          this.dataSource = res.result
        }
      })
      getAction('/game/bisLiabilityUserInfo/getLiability', {
        id: record.id,
      }).then((res) => {
        if (res.success) {
          this.liability = res.result
        }
      })
    },
  }
}
</script>

<style scoped></style>